package quoridor;

public class QuoridorDisplay implements Display {
	protected static Display theDisplay;
	GUI guiDisplay;
	DisplayType displayType;

    public QuoridorDisplay (DisplayType displayType) {
    	// initialise display type to text display
    	this.displayType = displayType;
    	
    	switch (displayType) {
    		case TEXT_DISPLAY:
    			guiDisplay = new TextDisplay();
    			break;
    		case PRETTY_DISPLAY:
    			throw new IllegalStateException ("PRETTY DISPLAY HAS NOT BEEN IMPLEMENTED");
    		default:
    			throw new IllegalStateException ("Not a recognised display");
    	}
    }
	
	public static Display instance() {
		return theDisplay;
	}
	
    public static Display make (DisplayType displayType)
    {
        theDisplay = new QuoridorDisplay (displayType);
        return theDisplay;
    }

	@Override
	public int[] initialSetup() {
		return guiDisplay.initialSetup();
	}

	@Override
	public Action getAction(PlayerColour colour) {
		return guiDisplay.getAction(colour);
	}

	@Override
	public void printBoard(Board board) {
		guiDisplay.printBoard(board);
	}

	@Override
	public void exitGameMessage() {
		guiDisplay.exitGameMessage();
	}

	@Override
	public void invalidMove() {
		guiDisplay.invalidMove();
	}

	@Override
	public void printVictory(Board gameBoard, PlayerColour playerColour) {
		guiDisplay.printVictory(gameBoard, playerColour);
	}
}
